//只用while求1到5的阶乘和
public class Test {
    public static void main(String[] args) {
        int i=1,res=1,j=1,sum=0;
        while(j<=5)
        {
            while (i <= j) {
                res = res * i;
                System.out.println(i+"的阶乘是"+res);
                i++;
            }
            j++;
            sum=sum+res;
        }
        System.out.println("1!+2!+3!+4!+5!="+sum);
    }
}
